package leet.ku._299;

public class Solution {
    public String getHint(String secret, String guess) {
        int[] box = new int[10];
        int a = 0;
        int b = 0;
        for (int i = 0; i < secret.length(); i++)
        	if (secret.charAt(i) == guess.charAt(i))
        		a++;
        	else {
        		if (box[secret.charAt(i) - '0']++ < 0)
        			b++;
        		if (box[guess.charAt(i) - '0']-- > 0)
        			b++;
        	}
        return a + "A" + b + "B";
    }
}